<?php TPL::output('m/header_meta.tpl.htm'); ?>
<style>
	#upload-form .file-input{width:14px;height:14px;left:0;top:0;}
</style>
<!-- 内容 -->
<div class="head_xx">
	<dl>
    	<dt>
    	
    	<img style="border-radius: 50%;" src="<?php echo get_avatar_url($this->user['uid'], 'max'); ?>?rand=<?php echo rand(1, 999); ?>" id="avatar_src" />
    	<?php if ($this->user['uid'] == $this->user_id) { ?>
    	<span id="avatar_uploader" style="position: absolute;z-index: 2;bottom:0;left: 0;opacity:0.5;width: 80px;height: 34px;"><img src="<?php echo G_STATIC_URL; ?>/mobile/images/add.jpg"></span>
    	<?php } ?>
    	</dt>
        <dd>
        	<h4><?php echo $this->user['user_name']; ?><?php if ($this->user['verified']) { ?><i class="icon-v<?php if ($this->user['verified'] == 'enterprise') { ?> i-ve<?php } ?>" title="<?php if ($this->user['verified'] == 'enterprise') { ?>企业认证<?php } else { ?>个人认证<?php } ?>"></i><?php } ?></h4>


            <h5><?php echo $this->job_name; ?></h5>
            
            <p>
            <?php if ($this->user['uid'] != $this->user_id AND $this->user_id) { ?>

	            <?php if ($this->user_gag['permission']['edit_gag'] == 1) { ?>
	            	<a class="<?php if ($this->user_is_gag) { ?> active<?php } ?>" data-types="<?php echo $this->user_is_gag; ?>" data-status="<?php if ($this->user_is_gag) { ?><?php echo 'add'; ?><?php } else { ?><?php echo 'del'; ?><?php } ?>" href="#" onclick="edit_gag($(this),'add', <?php echo $this->user['uid']; ?>);" ><?php if ($this->user_is_gag) { ?><?php _e('禁言'); ?><?php } else { ?><?php _e('已禁言'); ?><?php } ?></a>
	            <?php } ?>
            <a class="qxgz <?php if ($this->user_follow_check) { ?> active<?php } ?>" onclick="AWS.User.follow($(this),'user', <?php echo $this->user['uid']; ?>,'<?php echo new_post_hash();?>');"><?php if ($this->user_follow_check) { ?><?php _e('取消关注'); ?><?php } else { ?><?php _e('关注'); ?><?php } ?></a>

            <a class="mail"  href="m/inbox_new/uid-<?php echo $this->user['uid']; ?>">
                <img src="<?php echo G_STATIC_URL; ?>/mobile/images/mail.png" />
			</a>
            
            <?php } ?>
            

            <a href="m/visitor/uid-<?php echo $this->user['uid'];?>">最近访客(<?php echo $this->user_visitor_num['num']; ?>)</a>
            <!-- <a class="btn btn-success btn-stack" href="m/inbox_new/uid-<?php echo $this->user['uid']; ?>"><i class="icon icon-inbox"></i></a> -->
            </p>
        </dd>
    </dl>
</div>
		<!--头像信息end-->
		<!-- <div class="mod-head clearfix">

			<img src="<?php echo get_avatar_url($this->user['uid'], 'max'); ?>" alt="" class="img" width="50" />
			<div class="title clearfix">
				<h1 class="pull-left">
					<?php echo $this->user['user_name']; ?>
					<?php if ($this->user['verified']) { ?><i class="icon-v<?php if ($this->user['verified'] == 'enterprise') { ?> i-ve<?php } ?>" title="<?php if ($this->user['verified'] == 'enterprise') { ?>企业认证<?php } else { ?>个人认证<?php } ?>"></i><?php } ?>
				</h1>

				<?php if ($this->user['uid'] != $this->user_id AND $this->user_id) { ?>
				<span class="pull-right">
					<a class="btn btn-success btn-mini <?php if ($this->user_follow_check) { ?> active<?php } ?>" onclick="AWS.User.follow($(this), 'user', <?php echo $this->user['uid']; ?>);"><?php if ($this->user_follow_check) { ?><?php _e('取消关注'); ?><?php } else { ?><?php _e('关注'); ?><?php } ?></a>
					<a class="btn btn-success btn-stack" href="m/inbox_new/uid-<?php echo $this->user['uid']; ?>"><i class="icon icon-inbox"></i></a>
				</span>
				<?php } ?>
			</div>
			<?php if ($this->user['signature']) { ?>
			<p class="color-999"><?php echo $this->user['signature']; ?></p>
			<?php } ?>
		</div> -->
<div class="four_box">
	<dl>
    	<dt><?php _e('威望')?></dt>
        <dd><?php echo $this->user['reputation']; ?></dd>
    </dl>
    <dl>
    	<dt><?php _e('积分')?></dt>
        <dd><b><?php echo $this->user['integral']; ?></b></dd>
    </dl>
    <dl>
    	<dt><?php _e('获赞')?></dt>
        <dd><?php echo $this->user['agree_count']; ?></dd>
    </dl>
    <?php if(get_setting('thank')=='Y'):?>
    <dl>
    	<dt><?php _e('感谢')?></dt>
        <dd><?php echo $this->user['thanks_count']; ?></dd>
    </dl>
<?php endif;?>
    <div class="clear"></div>
    
</div>

<div class="gztj_tab">
	<ul>
    	<li class="cur"><a href="#join" role="tab" data-toggle="tab"><?php _e('参与'); ?>(<?php echo $this->user_actions_questions_count;?>)</a></li>
        <li><a href="#publish" role="tab" data-toggle="tab"><?php _e('发起'); ?>(<?php echo $this->user_actions_answers_count;?>)</a></li>
        <li><a href="#follow" role="tab" data-toggle="tab"><?php _e('关注'); ?></a></li>
        <li><a href="#profile" role="tab" data-toggle="tab"><?php _e('资料'); ?></a></li>
        <?php if ($this->user['uid'] == $this->user_id AND $this->user_id): ?>
        <li><a href="#favorite" role="tab" data-toggle="tab"><?php _e('收藏'); ?></a></li>
    	<?php endif; ?>
    </ul>
</div>
		<!-- <div class="mod-body clearfix">
			<ul>
				<li>
					<b><?php echo $this->user['reputation']; ?></b>
					<?php _e('威望')?>
				</li>
				<li>
					<b><?php echo $this->user['integral']; ?></b>
					<?php _e('积分')?>
				</li>
				<li>
					<b><?php echo $this->user['agree_count']; ?></b>
					<?php _e('获赞')?>
				</li>
				<li>
					<b><?php echo $this->user['thanks_count']; ?></b>
					<?php _e('感谢')?>
				</li>
			</ul>
		</div> -->
		<!-- <div class="mod-footer clearfix">
			<ul>
				<li class="active">
					<a href="#join" role="tab" data-toggle="tab"><?php _e('参与'); ?></a>
				</li>
				<li>
					<a href="#publish" role="tab" data-toggle="tab"><?php _e('发起'); ?></a>
				</li>
				<li>
					<a href="#follow" role="tab" data-toggle="tab"><?php _e('关注'); ?></a>
				</li>
				<li>
					<a href="#profile" role="tab" data-toggle="tab"><?php _e('资料'); ?></a>
				</li>
			</ul>
		</div>
	</div> -->
	<!-- end 个人信息 -->
	<div class="aw-box" style="padding-bottom: 60px;">
		<div class="tab-content">
			<!-- 参与列表 -->

			<div class="tab-pane active" id="join">
				<div class="aw-feed-list active">
                    <?php if ($this->user_actions_answers): ?>
                        <div class="mod-body">
                            <ul id="join_listview">

                                <?php foreach ($this->user_actions_answers AS $key => $val) { ?>
                                    <li>
                                        <div class="tj_mim">
                                            <h2><a onclick="AWS.DingTalk.open('<?php echo $val["link"] ?>')" ><?php echo $val['title']; ?></a>
                                            </h2>
                                            <p><?php echo htmlspecialchars(cjk_substr($val['answer_info']['answer_content'], 0, 130, 'UTF-8', '...')); ?></p>
                                        </div>
                                        <div class="interaction">
                                            <span><img src="<?php echo G_STATIC_URL; ?>/mobile/images/zan_ico.png"><?php echo $val['answer_info']['agree_count']; ?> <?php _e('个获赞'); ?></span>
                                            <span class="fr"><?php echo date_friendly($val['add_time'], 604800, 'Y-m-d'); ?></span>
                                        </div>
                                    </li>
                                <?php } ?>
                            </ul>
                        </div>
                    <?php else: ?>
                        <div class="mod-body">
                            <ul id="best_answers_listview"><p style="padding: 15px 0" align="center">没有内容</p></ul>
                        </div>
                    <?php endif; ?>

                    <?php if (count($this->user_actions_answers) > 10): ?>
                        <div class="mod-footer">
                            <a class="aw-load-more" id="load_join" auto-load="false"><i
                                        class="icon icon-loading icon-spin"></i> <span><?php _e('更多'); ?></span></a>
                        </div>
                    <?php endif; ?>
				</div>
			</div>
			<!-- end 参与列表 -->
            
			<!-- 发起列表 -->

			<div class="tab-pane" id="publish">
				<div class="aw-feed-list active">
                    <?php if ($this->user_actions_questions): ?>
                        <div class="mod-body">
                            <ul id="publish_listview">
                                <?php foreach ($this->user_actions_questions AS $key => $val) { ?>
                                    <li>
                                        <div class="tj_mim">
                                            <h2><a onclick="AWS.DingTalk.open('<?php echo $val["link"] ?>')" ><?php echo $val['title']; ?></a>
                                            </h2>

                                        </div>
                                        <div class="interaction">
                                            <span><img src="<?php echo G_STATIC_URL; ?>/mobile/images/gz.png"><?php echo $val['question_info']['focus_count']; ?> <?php _e('个关注'); ?></span>
                                            <span class="fr"><?php echo date_friendly($val['add_time'], 604800, 'Y-m-d'); ?></span>
                                        </div>
                                    </li>
                                <?php } ?>
                            </ul>
                        </div>
                    <?php else: ?>
                        <div class="mod-body">
                            <ul id="best_answers_listview"><p style="padding: 15px 0" align="center">没有内容</p></ul>
                        </div>
                    <?php endif; ?>
                    <?php if (count($this->user_actions_questions) > 10): ?>
                        <div class="mod-footer">
                            <a class="aw-load-more" id="load_publish" auto-load="false"><i
                                        class="icon icon-loading icon-spin"></i> <span><?php _e('更多'); ?></span></a>
                        </div>
                    <?php endif; ?>
				</div>
			</div>
			
			<!-- end 发起列表 -->

			<!-- 关注列表 -->
			<div class="tab-pane" id="follow">
				<!-- 关注 -->
				<?php if ($this->friends_list) { ?>
				<div class="mod card-mod">
					<div class="mod-head">
						<h2><?php _e('关注 %s 人', $this->user['friend_count']); ?></h2>
					</div>
					<div class="mod-body">
						<ul class="user-list">
							<?php foreach ($this->friends_list AS $key => $val) { ?>
							<li>
								<a href="m/people/<?php echo $val['url_token']; ?>"><img class="img" width="25" src="<?php echo get_avatar_url($val['uid'], 'max'); ?>" alt="<?php echo $val['user_name']; ?>" /></a>
							</li>
							<?php } ?>
						</ul>
					</div>
				</div>
                <?php } else { ?>
                    <div class="mod-body">
                        <ul id="best_answers_listview"><p style="padding: 15px 0" align="center">没有内容</p></ul>
                    </div>
                <?php } ?>

				<!-- end 关注 -->

				<!-- 关注者 -->
				<?php if ($this->fans_list) { ?>
				<div class="mod card-mod">
					<div class="mod-head">
						<h2><?php _e('粉丝 %s 人', $this->user['fans_count']); ?></h2>
					</div>
					<div class="mod-body">
						<ul class="user-list">
							<?php foreach ($this->fans_list AS $key => $val) { ?>
							<li>
								<a href="people/<?php echo $val['url_token']; ?>"><img class="img" width="25" src="<?php echo get_avatar_url($val['uid'], 'max'); ?>" alt="<?php echo $val['user_name']; ?>"></a>
							</li>
	           				<?php } ?>
						</ul>
					</div>
				</div>
	            <?php } ?>
				<!-- end 关注者 -->

				<!-- 关注话题 -->
				<?php if ($this->focus_topics) { ?>
				<div class="mod card-mod focus-topics">
					<div class="mod-head">
						<h2><?php _e('关注 %s 个话题', $this->user['topic_focus_count']); ?></h2>
					</div>
					<div class="mod-body clearfix">
						<?php foreach ($this->focus_topics AS $key => $val) { ?>
						<span class="topic-tag">
							<a class="text" href="m/topic/<?php echo $val['url_token']; ?>"><?php echo $val['topic_title']; ?></a>
						</span>
						<?php } ?>
					</div>
				</div>
				<?php } ?>
				<!-- end 关注话题 -->
			</div>
			<!-- end 关注列表 -->

			<!-- 个人资料 -->
			<div class="tab-pane" id="profile">
				<div class="mod card-mod people-profile">
					<div class="mod-head">
						<h2><?php _e('个人资料'); ?></h2>
					</div>
					<div class="mod-body">
						<ul>
							<li>
								<i class="icon icon-location"></i>
								<span class="color-666"> <?php _e('现居'); ?> :</span>
								<?php if ($this->user['province']) { ?>
									<?php echo $this->user['province']; ?>
									<?php echo $this->user['city']; ?>
								<?php } ?>
							</li>
							<li>
								<i class="icon icon-job"></i>
								<span class="color-666"> <?php _e('职业'); ?> :</span> <?php if ($this->job_name) { ?><?php echo $this->job_name; ?><?php } ?>
							</li>
							<li>
								<i class="icon icon-bind"></i>
								<span class="color-666"><?php _e('绑定'); ?>  :</span>
								<?php if (get_setting('sina_weibo_enabled') == 'Y' AND $this->sina_weibo_url) { ?>
									<?php if ($this->sina_weibo_url AND get_setting('sina_weibo_enabled') == 'Y') { ?><a href="<?php if ($this->sina_weibo_url) { ?><?php echo $this->sina_weibo_url; ?><?php } else { ?>javascript:;<?php } ?>" title="<?php _e('微博'); ?>"><?php _e('微博'); ?></a><?php } ?>
								<?php } ?>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<!-- end 个人资料 -->
            
			<div class="tab-pane" id="favorite">
				<div class="mod card-mod people-favorite">
					<div class="aw-feed-list active">
						<div class="mod-body">
							<ul id="favorite_listview">
							</ul>
						</div>
						<div class="mod-footer">
							<a id="load_favorite" class="aw-load-more"><i class="icon icon-loading icon-spin"></i> <span><?php _e('更多'); ?></span></a>
						</div>
					</div>
				</div>
			</div>
		</div>
	
<!-- end 内容 -->

<script type="text/javascript">
    $(function(){
    	var tabs = $(".gztj_tab ul").children('li');
		tabs.each(function(i){
			$(this).click(function(){
				  $(this).siblings().removeClass('cur');
				  $(this).addClass('cur');
			})
		})
    })
	$(document).ready(function () {

        
		var PEOPLE_USER_ID = '<?php echo $this->user['uid']; ?>';

	    var ACTIVITY_ACTIONS = '<?php echo implode(',', array(
	        ACTION_LOG::ADD_QUESTION,
	        ACTION_LOG::ANSWER_QUESTION,
	        ACTION_LOG::ADD_REQUESTION_FOCUS,
	        ACTION_LOG::ADD_AGREE,
	        ACTION_LOG::ADD_TOPIC,
	        ACTION_LOG::ADD_TOPIC_FOCUS,
	        ACTION_LOG::ADD_ARTICLE,
	        ACTION_LOG::ADD_AGREE_ARTICLE,
	        ACTION_LOG::ADD_COMMENT_ARTICLE
	    )); ?>';

		var fileUpload = new FileUpload('avatar', $('#avatar_uploader'), $('#avatar_src'), G_BASE_URL + '/account/ajax/avatar_upload/', {'loading_status' : '#avatar_uploading_status'});


        AWS.load_list_view(G_BASE_URL + '/people/ajax/user_actions/uid' + '-' + PEOPLE_USER_ID + '__actions-201', $('#load_join'), $('#join_listview'), 1);	// 参与的问题

		AWS.load_list_view(G_BASE_URL + '/people/ajax/user_actions/uid' + '-' + PEOPLE_USER_ID + '__actions-101', $('#load_publish'), $('#publish_listview'), 1);	// 发起的问题

		AWS.load_list_view(G_BASE_URL + '/m/ajax/favorite_list/', $('#load_favorite'), $('#favorite_listview'));
	});

    function edit_gag(selector, type, data_id){
        
    	if(selector.attr('data-types') == 1)
    	{    
             AWS.DingTalk.choose([{
		            key: '禁言1小时', //显示文本
		            value: 'hour' //值，
		        }, {
		            key: '禁言1天',
		            value: 'day'
		        }, {
		            key: '禁言1周',
		            value: 'week'
		        }, {
		            key: '禁言1月',
		            value: 'month'
		        }, {
		            key: '禁言1年',
		            value: 'year'
		        }, {
		            key: '永久禁言',
		            value: 'forever'
		        }],"禁言1天",function(result){
		        	    AWS.edit_publish(selector,type,data_id,selector.attr('data-status'),result.value); 	
		        });
    	}else if(selector.attr('data-types') == 0){
             AWS.edit_publish(selector,'del',data_id,selector.attr('data-status')); 
    	}

    }

</script>

<?php TPL::output('m/footer.tpl.htm'); ?>